//
//  UIButton+Extension.swift
//  mySwiftWeibo
//
//  Created by apple on 16/7/31.
//  Copyright © 2016年 itcast沈庆伟. All rights reserved.
//

import UIKit

extension UIButton{
    
    
    //便利构造函数
    convenience init(imageName: String, title: String, titleColor: UIColor = UIColor.darkGrayColor(), titleFont: CGFloat = 15, bgImageName: String = "timeline_card_bottom_background"){
        
        self.init()
        
        self.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(titleColor, forState: UIControlState.Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(titleFont)
        self.setBackgroundImage(UIImage(named: bgImageName), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: bgImageName + "_highlighted"), forState: UIControlState.Highlighted)
    }
    
}
